<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class ChangeResourceSetIdToResourceSetNameOnTables extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        // 更改nw_ybz_ecs表的resource_set_id为resource_set_name
        Schema::table('nw_ybz_ecs', function (Blueprint $table) {
            $table->renameColumn('resource_set_id', 'resource_set_name');
        });

        // 更改nw_ybz_dcs表的resource_set_id为resource_set_name
        Schema::table('nw_ybz_dcs', function (Blueprint $table) {
            $table->renameColumn('resource_set_id', 'resource_set_name');
        });
        Schema::table('nw_ybz_elb', function (Blueprint $table) {
          $table->renameColumn('resource_set_id', 'resource_set_name');
        });
        Schema::table('nw_ybz_rds', function (Blueprint $table) {
          $table->renameColumn('resource_set_id', 'resource_set_name');
        });
        Schema::table('nw_ybz_bms', function (Blueprint $table) {
          $table->renameColumn('resource_set_id', 'resource_set_name');
        });
        Schema::table('nw_ybz_tx_ip', function (Blueprint $table) {
          $table->renameColumn('resource_set_id', 'resource_set_name');
        });

        // 重复以上操作，为剩余的表做同样的修改
        // ...
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        // 回滚操作，将resource_set_name改回resource_set_id
        Schema::table('nw_ybz_ecs', function (Blueprint $table) {
            $table->renameColumn('resource_set_name', 'resource_set_id');
        });

        Schema::table('nw_ybz_dcs', function (Blueprint $table) {
            $table->renameColumn('resource_set_name', 'resource_set_id');
        });

        Schema::table('nw_ybz_elb', function (Blueprint $table) {
          $table->renameColumn('resource_set_name', 'resource_set_id');
        });
        
        Schema::table('nw_ybz_rds', function (Blueprint $table) {
          $table->renameColumn('resource_set_name', 'resource_set_id');
        });
        Schema::table('nw_ybz_bms', function (Blueprint $table) {
          $table->renameColumn('resource_set_name', 'resource_set_id');
        });
        Schema::table('nw_ybz_tx_ip', function (Blueprint $table) {
          $table->renameColumn('resource_set_name', 'resource_set_id');
        });
        // 同样，为所有修改过的表添加回滚逻辑
        // ...
    }
}